package myjava.test;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

/**
 * @author Yancy
 * @program springioctest
 * @create 2020-09-07
 */
public class SaveObject {
  public static void main(String[] args)  {
    //

      Person person = new Person("tom","男");


      try {
          FileOutputStream fos = new FileOutputStream("c://person.data");
          ObjectOutputStream oos = new ObjectOutputStream(fos);
          oos.writeObject(person);
          oos.close();
      } catch (IOException e) {
          e.printStackTrace();
      }


  }
}
